//
//  ResetWordViewController.m
//  F50
//
//  Created by WN on 15/5/14.
//  Copyright (c) 2015年 ZACK. All rights reserved.
//

#import "ResetWordViewController.h"

@interface ResetWordViewController ()<UITextFieldDelegate>

@end

@implementation ResetWordViewController
- (void)createBackground
{
    self.navigationController.navigationBarHidden = YES;

    
    UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    backBtn.frame = CGRectMake(20, 32, 15, 18);
    [backBtn setBackgroundImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
    [backBtn addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:backBtn];
    
    
    
    
    //中间标题
    UILabel *  nav_title=[[UILabel alloc] initWithFrame:CGRectMake(WIDTH/2 - 80, 20, 160, 40)];
    nav_title.text = @"重置密码";
    nav_title.textAlignment = NSTextAlignmentCenter;
    nav_title.font=[UIFont boldSystemFontOfSize:20];
    nav_title.textColor=[UIColor whiteColor];
    nav_title.backgroundColor=[UIColor clearColor];
    [self.view addSubview:nav_title];
    
//    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(15, 80, WIDTH - 30, 100)];
    self.footView.layer.cornerRadius = 8;
//    view.backgroundColor = [UIColor whiteColor];
//    view.userInteractionEnabled = YES;
//    [self.view addSubview:view];
//    UILabel *passLab = [[UILabel alloc]initWithFrame:CGRectMake(10, 60, 50, 30)];
//    passLab.text = @"密码";
//    [view addSubview:passLab];
//    self.passWord = [[UITextField alloc]initWithFrame:CGRectMake(45, 90, WIDTH - 90, 40)];
//    self.passWord.placeholder = @"请填写密码";
//    self.passWord.delegate = self;
//  
//    self.passWord.backgroundColor = [UIColor whiteColor];
//    self.passWord.layer.cornerRadius = 5;
//    [self.bgView addSubview:self.passWord];
    
}

- (void)viewWillAppear:(BOOL)animated {
    [self createBackground];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

-(void)back
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (IBAction)commitNewWord:(id)sender {
    NSLog(@"%@",self.passsWord.text);
    
    NSDictionary * date = [[NSDictionary  alloc]initWithObjectsAndKeys:[USER_DEFAULT objectForKey:@"token"],@"token",self.phoneNum,@"phone",self.passsWord.text,@"newpwd",nil];
    NSDictionary *pram = [[NSDictionary alloc]initWithObjectsAndKeys:@"member",@"class",@"resetpwd",@"func",date,@"param", nil];
    
    [[AFCustomObject shareAFCustomObject] registrAtionWithParams:pram success:^(NSDictionary *result) {
        NSLog(@"%@",result);
        NSLog(@"%@",[result objectForKey:@"result"]);
        
   [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:1] animated:YES];
 
    } fail:^{
        NSLog(@"1111111");
    }];
    
    

}
@end
